#ifdef TEST_LUA_CONTROLLER
#include "lua_controller.h"
#include <iostream>
using namespace std;

void bnb_terminate (int status) {
  exit(status);
}

int main (int argc, char** argv) {
  logger_init ("bnb.log", bnb_terminate);
  logger_toggle_flush(true);

  LuaController ctrl;
  ctrl.loadScript("example.lua");

  try {
    cout << "Name : " << ctrl.getString("name") << endl;
    cout << "Edge width : " << ctrl.getString("edgeWidth") << endl;
    cout << "Time : " << ctrl.getString("time") << endl;

    vector< vector<string> > array;
    ctrl.getString2DArray(array, "data");

    vector< vector<string> >::iterator itrRow;
    vector<string>::iterator itrCol;
    vector<string> row;

    for (itrRow = array.begin(); itrRow != array.end(); ++itrRow) {
      row = *itrRow;
      for (itrCol = row.begin(); itrCol != row.end(); ++itrCol) {
        cout << "\"" << *itrCol << "\" ";
      }
      cout << endl;
    }
  }
  catch (TypeCastException& e) {
    LOG_FATAL(e.what());
  }
  catch (const char* e) {
    LOG_FATAL(e);
  }

  logger_quit();
  return EXIT_SUCCESS;
}
#endif

